package com.shuqi.activity.viewport;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.SeekBar;

public class shuqiDefineSeekBar extends SeekBar {

    private boolean isResopnseTouch = true;

    public shuqiDefineSeekBar(Context context) {
        super(context);
    }

    public shuqiDefineSeekBar(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (isResopnseTouch) {
            return super.onTouchEvent(event);
        } else {
            return false;
        }
    }

    public boolean isResopnseTouch() {
        return isResopnseTouch;
    }

    public void setResopnseTouch(boolean isResopnseTouch) {
        this.isResopnseTouch = isResopnseTouch;
    }

    public void setPercent(float percent) {
        setProgress((int) (percent * getMax()));
    }

    public float getPercent() {
        return (float) getProgress() / getMax();
    }

}
